//
//  RecommendCell.m
//  PlayerFix
//
//  Created by DAT on 15/11/4.
//  Copyright © 2015年 DAT. All rights reserved.
//

#import "RecommendCell.h"
#import "RecommendModel.h"
#import <UIImageView+WebCache.h>

@implementation RecommendCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self creatSubviews];
    }
    
    return self;
}

- (void)creatSubviews{
    
    self.coverImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 170, 170)];
    self.coverImg.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.coverImg];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 170, 170, 30)];
    self.nameLabel.backgroundColor = [UIColor clearColor];
    self.nameLabel.font = [UIFont systemFontOfSize:15];
    self.nameLabel.textColor = [UIColor colorWithRed:0.27 green:0.25 blue:0.25 alpha:1.0];
    [self.contentView addSubview:self.nameLabel];
    
    self.channelNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 200, 170, 15)];
    self.channelNameLabel.backgroundColor = [UIColor clearColor];
    self.channelNameLabel.font = [UIFont systemFontOfSize:13];
    self.channelNameLabel.textColor = [UIColor colorWithRed:101 / 255.0 green:149 / 255.0 blue:97 / 255.0 alpha:1.0];
    [self.contentView addSubview:self.channelNameLabel];
    
}

- (void)setRecommendModel:(RecommendModel *)recommendModel{
    
    if (_recommendModel != recommendModel) {
        
        _recommendModel = recommendModel;
    }
    
    self.nameLabel.text = _recommendModel.name;
    [self.coverImg sd_setImageWithURL:[NSURL URLWithString:_recommendModel.pic] placeholderImage:[UIImage imageNamed:@"holderPic_recommend.png"]];
    NSString *name = [_recommendModel.channel objectForKey:@"name"];
    self.channelNameLabel.text = [NSString stringWithFormat:@"%@  频道", name];
    
    
    
    
    
    
}



@end
